JavaScript provides several properties to work with numbers. These properties are part of the Number object and can be used to get information about numbers.
The smallest interval between two representable numbers.
let epsilon = Number.EPSILON;
console.log(epsilon); // Outputs: 2.220446049250313e-16
The largest positive number that can be represented in JavaScript.
let maxValue = Number.MAX_VALUE;
console.log(maxValue); // Outputs: 1.7976931348623157e+308
The smallest positive number that can be represented in JavaScript.
let minValue = Number.MIN_VALUE;
console.log(minValue); // Outputs: 5e-324
The maximum safe integer in JavaScript (253 - 1).
let maxSafeInteger = Number.MAX_SAFE_INTEGER;
console.log(maxSafeInteger); // Outputs: 9007199254740991
The minimum safe integer in JavaScript (-(253 - 1)).
let minSafeInteger = Number.MIN_SAFE_INTEGER;
console.log(minSafeInteger); // Outputs: -9007199254740991
Represents positive infinity.
let positiveInfinity = Number.POSITIVE_INFINITY;
console.log(positiveInfinity); // Outputs: Infinity
Represents negative infinity.
let negativeInfinity = Number.NEGATIVE_INFINITY;
console.log(negativeInfinity); // Outputs: -Infinity
Represents a value that is "Not-a-Number".
let notANumber = Number.NaN;
console.log(notANumber); // Outputs: NaN